package com.ctshk.rpc.order.custom.mapper;

import com.ctshk.rpc.order.custom.base.CustomBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.order.custom.entity.CustomizedOrderTouristGroup;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 游客小组 Mapper 接口
 * </p>
 *
 * @author 叶冠峰
 * @since 2021-02-22
 */
public interface CustomizedOrderTouristGroupMapper extends CustomBaseMapper<CustomizedOrderTouristGroup> {

	/**
     * 查询最大组名
     *
     * @return 返回值
     * @param scheduleId
     */
    @Select("SELECT id id,max(group_name) groupName FROM t_customized_order_tourist_group ")
    CustomizedOrderTouristGroup queryMaxGroupName(@Param("schedule_id") Long scheduleId);

    /**
     * 删除团期旅客分组记录
     * @param scheduleId
     * @param userId
     */
    @Update("UPDATE t_customized_order_tourist_group\n" +
            "SET is_deleted = 1,modified_id = #{user_id}\n" +
            "WHERE schedule_id = #{schedule_id} AND is_deleted = 0")
    void delBySchedule(@Param("schedule_id")Long scheduleId,@Param("user_id")Long userId);
}
